#include "mystdio.h"
#include <string.h>
#include <unistd.h>
#include <stdio.h>
int main()
{
    MYFILE* fp = myfopen("log.txt","w");
    if(fp == NULL )
    {
        return 1;
    }
    char data[128];
    int cnt=10;
    const char* s = "hello xiaodu!";

    while(cnt--)
    {
        snprintf(data,sizeof(data),"%s:%d\n",s,cnt);
        mywrite(data,strlen(data),fp);
        sleep(2);
    }

    myfclose(fp);
    return 0;
}
